﻿using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using System;
using System.Windows;

namespace MT.CustomUserControl.ViewModels
{
    public class SearchUcViewModel : ObservableObject
    {
        public Action<SearchUcViewModel> CheckPatientByCondition;

        /// <summary>
        /// 搜索选择框
        /// </summary>
        private Visibility searchUserControlVisibility = Visibility.Collapsed;
        public Visibility SearchUserControlVisibility
        {
            get { return searchUserControlVisibility; }
            set { SetProperty(ref searchUserControlVisibility, value); }
        }

        /// <summary>
        /// 起始日期
        /// </summary>
        private string startDate = string.Empty;
        public string StartDate
        {
            get { return startDate; }
            set { SetProperty(ref startDate, value); }
        }

        /// <summary>
        /// 截至日期
        /// </summary>
        private string endDate = string.Empty;
        public string EndDate
        {
            get { return endDate; }
            set { SetProperty(ref endDate, value); }
        }

        /// <summary>
        /// 条码
        /// </summary>
        private string barCode = string.Empty;
        public string BarCode
        {
            get { return barCode; }
            set { SetProperty(ref barCode, value); }
        }

        /// <summary>
        /// 姓名
        /// </summary>
        private string name = string.Empty;
        public string Name
        {
            get { return name; }
            set { SetProperty(ref name, value); }
        }

        /// <summary>
        /// 性别
        /// </summary>
        private string gender = string.Empty;
        public string Gender
        {
            get { return gender; }
            set { SetProperty(ref gender, value); }
        }

        /// <summary>
        /// 电话号
        /// </summary>
        private string phone = string.Empty;
        public string Phone
        {
            get { return phone; }
            set { SetProperty(ref phone, value); }
        }

        private RelayCommand m_CheckCommand;
        public RelayCommand CheckCommand
        {
            get
            {
                if (m_CheckCommand == null)
                {
                    m_CheckCommand = new RelayCommand(CheckCommandFunc);
                }
                return m_CheckCommand;
            }
        }

        public void CheckCommandFunc()
        {
            CheckPatientByCondition.Invoke(this);
        }
    }
}
